<template>
<div></div>
</template>

<script>
import { getAccessToken } from '@/utils/accessToken'
import { wxredirect_uri, wxappid, wxagentid } from '@/config'
export default {
  data() {
    return {}
  },
  mounted() {
    this.nextPage();
  },
  computed:{
    wxpage(){
      let url = 'https://open.weixin.qq.com/connect/oauth2/authorize?'
      url += 'appid=' + wxappid
      url += '&redirect_uri=' + encodeURIComponent(wxredirect_uri)
      url += '&response_type=code&scope=snsapi_privateinfo&state=STATE'
      url += "&agentid=" + wxagentid + "#wechat_redirect"
      return url;
    }
  },
  methods: {
    nextPage(){
      if (getAccessToken()) {
        this.$router.push("/")
      }else{
        //const wxpage = this.wxpage;
        window.location.href = this.wxpage
      }
    }
  }
}
</script>

<style scoped>

</style>
